]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
shell-global: Disconnect from stage events on X11 display close
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 2 Oct 2019 19:24:37 +0000 (21:24 +0200)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 8 Oct 2019 15:49:30 +0000 (17:49 +0200)
As per GNOME/mutter!385 [1], the compositor is finalized an its pointer
cleared on display close.

However, since the shell reacts to such events instead of controlling them,
when the shell is stopping or restarting and its display closing, the shell
stage destroys its children after the display closing is finished and during
this process the focus is unset, causing focus_actor_changed() to be called
and thus calls to meta_stage_is_focused() which deferences the now NULL
compositor, leading to a crash on shutdown.

Since after this point we should just ignore any stage event, disconnect
from them all.

[1] https://gitlab.gnome.org/GNOME/mutter/merge_requests/385

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/746

src/shell-global.c

index 80f251272c4938e4d623e65acc57ebb1a4f8166e..7f74a34fd8107a51642662c8b442f342fb4a1083 100644 (file)
@@ -832,6 +832,13 @@ entry_cursor_func (StEntry  *entry,
                            use_ibeam ? META_CURSOR_IBEAM : META_CURSOR_DEFAULT);
 }
 
+static void
+on_x11_display_closed (MetaDisplay *display,
+                       ShellGlobal *global)
+{
+  g_signal_handlers_disconnect_by_data (global->stage, global);
+}
+
 void
 _shell_global_set_plugin (ShellGlobal *global,
                           MetaPlugin  *plugin)
@@ -895,6 +902,10 @@ _shell_global_set_plugin (ShellGlobal *global,
   g_signal_connect (global->meta_display, "notify::focus-window",
                     G_CALLBACK (focus_window_changed), global);
 
+  if (global->xdisplay)
+    g_signal_connect_object (global->meta_display, "x11-display-closing",
+                             G_CALLBACK (on_x11_display_closed), global, 0);
+
   backend = meta_get_backend ();
   settings = meta_backend_get_settings (backend);
   g_signal_connect (settings, "ui-scaling-factor-changed",